package com.wj;

import com.wj.Controller.UserController;
import com.wj.service.UserService;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.ComponentScan;

@ComponentScan("com.wj")
@SpringBootApplication
public class IocDemoApplication {
	public static void main(String[] args) {
		ApplicationContext context = SpringApplication.run(IocDemoApplication.class,args);
	    UserController bean = context.getBean(UserController.class);
        bean.sayHi();
		UserService userService = (UserService) context.getBean("userService");
		userService.sayHi();
	}
}